package lagou.boot;

import com.lagou.entity.RpcRequest;
import com.lagou.service.IUserService;
import lagou.client.RPCConsumer;

public class ConsumerBoot {

    //参数定义
    private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {

        //1.创建代理对象
        IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class);

        //2.循环给服务器写数据
        while (true){
            RpcRequest rpcRequest = new RpcRequest();
            rpcRequest.setClassName("com.lagou.entity.RpcRequest");
            rpcRequest.setMethodName("getRpcRequest");
            rpcRequest.setRequestId("userServiceImpl");
            rpcRequest.setParameters(new Object[]{"Hi"});
            rpcRequest.setParameterTypes(new Class[]{String.class});
            String result = service.getRpcRequest(rpcRequest);
            System.out.println(result);
//            String result = service.sayHello("are you ok !!");
//            System.out.println(result);
            Thread.sleep(2000);
        }

    }
}
